<ui:composition template="/layouts/default.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:sec="http://www.springframework.org/security/tags">

	<ui:define name="title">#{msg.team}</ui:define>
	<ui:define name="body">
		<div id="content">
			<div id="main">
				<h:form styleClass="panelForm">
					<p:messages id="messages" autoUpdate="true" closable="true" />
					<p:dataTable id="tableLoad" var="team" value="#{teamMB.teamLazyDataModel}" 	emptyMessage="#{msg.emptyList}" 
						rows="#{teamMB.maxPage}" lazy="true" paginator="true" 
						rowsPerPageTemplate="#{teamMB.minPage}, #{teamMB.averagePage}, #{teamMB.maxPage}"
						styleClass="loadTable">
						
						<p:column headerText="#{msg.name}">
							<h:outputText value="#{team.name}" />
						</p:column>
						
						<p:column headerText="#{msg.skill}">
							<h:outputText value="#{team.skill}" />
						</p:column>						
						
						<p:column headerText="#{msg.actions}">
							<p:commandButton value="#{msg.edit} #{msg.team}" action="#{teamMB.edit(team)}" ajax="false" />
							<p:commandButton value="#{msg.delete} #{msg.team}" action="#{teamMB.delete(team.id)}" update="tableLoad">
								<p:confirm header="#{msg.confirm}" message="#{msg.confirmDelete}" icon="ui-icon-alert" />
							</p:commandButton>
						</p:column>
					</p:dataTable>

					<p:confirmDialog global="true" showEffect="fade">
						<p:commandButton value="#{msg.yes}" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
						<p:commandButton value="#{msg.no}" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
					</p:confirmDialog>

					<p:panel styleClass="buttonForm">
						<p:commandButton value="#{msg.create} #{msg.team}" action="#{teamMB.create}" ajax="false" />
					</p:panel>
				</h:form>
			</div>
		</div>
	</ui:define>
</ui:composition>